
//
// 120311 - AH - (Fantoft) Created.
// 120313 - AH - Made Serializable.
// 120407 - AH - (Midtun) Made this a final class (was interface), think need
//               only this.
//

package org.soekrat.server.serialization;

import java.io.Serializable;

/**
 * <p>
 *   Base class for objects that describes a passing strategy. 
 * </p>
 * @author Arne Halvorsen (AH)
 * @author Laetitia Le Chatton (LLC) 
 */
public final class PassingStrategySerializable implements Serializable
{
  private static final long serialVersionUID=-1843499758379365408L;

  private String name=null;
  
  private String data=null;
  
  /**
   * <p>
   *   Constructor.
   * </p>
   */
  public PassingStrategySerializable(){}
  
  /**
   * <p>
   *   Gets name.
   * </p>
   * @return Name or {@code null} if not sat.
   */
  public String name(){ return this.name; }
  
  /**
   * <p>
   *   Sets name.
   * </p>
   * @param name Name.
   * @return {@code this}.
   */
  public PassingStrategySerializable name(String name)
  {
    if (name==null)
    {
      throw new NullPointerException("name");
    }
    
   this.name=name;
   return this;
  }
  
  /**
   * <p>
   *   Gets data defining state of passing strategy.
   * </p>
   * @return Data or {@code null} if has no data.
   */
  public String data(){ return this.data; }
  
  /**
   * <p>
   *   Sets data defining state of passing strategy.
   * </p>
   * @param data Data.
   * @return {@code this}.
   */
  public PassingStrategySerializable data(String data)
  {
    if (data==null)
    {
      throw new NullPointerException("data");
    }
    
    this.data=data;
    return this;
  }
  
  @Override
  public String toString() 
  {
    StringBuilder sb=new StringBuilder();
    
    sb.append("name=").append(this.name).append(", data=").append(this.data);
    
    return sb.toString();
  }
  
}
